package abstractfactory;

public class AbstractFactoryMain {

    public static void main(String[] args) {
        /**
         * 抽象工厂模式
         * 工厂的抽象工厂
         * 方便品牌的扩展但是不方便产品的扩展
         */

        IPhoneFactory iPhone=null;
        RouterFactory router=null;
        System.out.println("=============小米产品==================");
        AbstractFactory xiaoMiFactory=new XiaoMiFactory();
        iPhone = xiaoMiFactory.getIPhoneFactory();
        iPhone.openIPhone();
        iPhone.closeIPhone();
        router = xiaoMiFactory.getRouterFactory();
        router.openRouter();
        router.linkRouter();
        System.out.println("=============华为产品==================");
        AbstractFactory huaWeiFactory=new HuaWeiFactory();
        iPhone = huaWeiFactory.getIPhoneFactory();
        iPhone.openIPhone();
        iPhone.closeIPhone();
        router = huaWeiFactory.getRouterFactory();
        router.openRouter();
        router.linkRouter();

    }
}
